package com.guldan.core.enums;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Silas.
 * Date: 2016/12/4
 * Time: 0:24
 */
public enum ValidatingRegisterTypeEn {

    idCardFormatError(1, "身份证编码规则错误"),
    citizenInfoUnmatch(2, "上报人员和居民信息不对应"),
    bankNumberError(3, "银行卡信息错误"),
    hasOwnedSubsidyBatch(4, "已在%s区划中登记，%s批次中登记"),
    execlNoRecord(5, "文件为空 or 文件中无登记记录"),
    emptyField(6, "%s，必填项不能为空"),
    formatError(7, "%s，格式错误"),
    projectNameNotFind(8, "补贴项目名称错误，系统内不存在"),
    projectSbExceedMax(9, "补贴发放次数超出项目限定条件"),
    areaNotFind(10, "系统内不存在该补贴登记区划信息"),
    idCardLengthError(11, "身份证长度错误"),
    moneyLessThan0(12, "%s，补贴金额不能为负"),
    citizenNotFind(13, "系统内不存在此居民信息"),
    citizenNotMatchName(14, "与系统内居民基础信息-姓名不匹配"),
    citizenNotMatchBankName(15, "与系统内居民基础信息-银行信息不匹配（开户银行名称不一致）"),
    citizenNotMatchBankNumber(16, "与居民基础信息-银行卡号不匹配"),
    emptyFieldName(17, "未找到，%s"),
    emptyFieldByName(18, "第%s条登记记录，%s不能为空"),
    missExtProName(19, "扩展属性，%，不存在"),
    formatErrorByRow(20, "第%s条记录，%s，格式错误"),
    notFindBankName(21, "银行卡名字不存在"),
    hasRuningBatch(22,"当前项目有发放年度[%s]，发放次数[%s]，正在走流程中，不可新添加登记人员"),


    success(99, "成功"),

    unknow(-1, "未知");

    private Integer code;
    private String mean;

    ValidatingRegisterTypeEn(Integer code, String mean) {
        this.code = code;
        this.mean = mean;
    }

    public static ValidatingRegisterTypeEn toEnum(Integer code) {
        ValidatingRegisterTypeEn[] values = values();
        for (ValidatingRegisterTypeEn en : values) {
            if (en.getCode().equals(code)) {
                return en;
            }
        }
        return unknow;
    }

    public Integer getCode() {
        return code;
    }

    public String getMean() {
        return mean;
    }

    public static List<EnumDTO> getList() {
        List<EnumDTO> list = new ArrayList<>();
        for (int k = 0; k < values().length; k++) {
            list.add(new EnumDTO(values()[k].getCode(), values()[k].getMean(), ""));
        }
        return list;
    }

}
